# Maintainer: Ash Berlin-Taylor <ash_archlinux@firemirror.com>
pkgname='perl-yaml-pp'
pkgver=0.37.0
pkgrel=1
_distdir="YAML-PP-v$pkgver"
pkgdesc="Simple configuration automation"
arch=('any')
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('perl>=0')
makedepends=('perl-test-deep>=0' 'perl-test-warn>=0')
url='https://search.cpan.org/dist/YAML-PP'
source=("https://cpan.metacpan.org/authors/id/T/TI/TINITA/YAML-PP-v$pkgver.tar.gz")
sha512sums=('bec5f665fe3b8b42c201b858da61754257026cdac91746e23979c41122beb867ff3204e67fd0243db07023352bc2fd28c96e37504de9465bf27f088acf91106a')

build() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""                 \
      PERL_AUTOINSTALL=--skipdeps                            \
      PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'"     \
      PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
      MODULEBUILDRC=/dev/null

    cd "$srcdir/$_distdir"
    /usr/bin/perl Makefile.PL
    make
  )
}

check() {
  cd "$srcdir/$_distdir"
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""
    make test
  )
}

package() {
  cd "$srcdir/$_distdir"
  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}
